import 'package:flutter/material.dart';
import 'package:flutter_common/ui/widget/skeleton.dart';
import 'package:flutter_common/ui/widget/text.dart';
import 'package:flutter_common/util/toast_util.dart';

class TextDemo extends StatelessWidget with LoadingDataSkeleton<int> {

  Future<int> _dd() {
    return Future.delayed(const Duration(seconds: 1)).then((value) => 1);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text("text demo"),
        ),
        body: FutureBuilder(future: _dd(), initialData: 0,builder: loadingData));
  }

  @override
  Widget doneWidget(BuildContext context, data) {
    return SingleChildScrollView(
        child: Column(
          children: [
            ShapeText(
              "text",
              margin: EdgeInsets.all(10),
              backgroundColor: Colors.greenAccent,
            ),
            ShapeText(
              "text",
              margin: EdgeInsets.all(10),
              padding: EdgeInsets.all(15),
              onPressed: () {
                ToastUtil.showToast("click text");
              },
            ),
            ShapeText(
              "text",
              margin: EdgeInsets.all(20),
              padding: EdgeInsets.all(10),
              onLongPressed: () {
                ToastUtil.successToast("long press text");
              },
            ),
            ShapeText(
              "texMMMMGGGGGMMMtrr",
              backgroundColor: Colors.redAccent,
              borderRadius: BorderRadius.circular(15),
              margin: EdgeInsets.all(20),
              padding: EdgeInsets.all(10),
            ),
            ShapeText(
              "texMMMMMMMMMMMMMMMMMMMMt",
              backgroundColor: Colors.redAccent,
              borderRadius: BorderRadius.circular(15),
              margin: EdgeInsets.all(20),
              padding: EdgeInsets.all(10),
              onPressed: () {
                ToastUtil.successToast("long press text");
              },
            ),
          ],
        ));
  }

}
